package com.tang.controller;

import com.tang.dto.ImagesDto;
import com.tang.dto.LinkDto;
import com.tang.sys.ResponseResult;
import com.tang.sys.entity.Images;
import com.tang.sys.service.IImagesService;
import com.tang.sys.vo.LinkVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/sys/background")
public class AdminImageController {
    @Autowired
    private IImagesService iImagesService;

    //获取全部的img
    @GetMapping("/images")
    public ResponseResult getAllList(Integer pageNum, Integer pageSize, ImagesDto imagesDto){

        return iImagesService.getAllList(pageNum,pageSize,imagesDto);
    }
    //新增
    @PostMapping
    public ResponseResult addImage(@RequestBody Images images){

        return iImagesService.addImage(images);
    }

    //删除
    @DeleteMapping("{id}")
    public ResponseResult deleteImage(@PathVariable("id") Long id){
        return iImagesService.deleteImage(id);
    }
    //修改 先获取
    @GetMapping("{id}")
    public ResponseResult getImageInfo(@PathVariable("id") Long id){

        return iImagesService.getImageInfo(id);
    }
    @PutMapping
    public ResponseResult updateImage(@RequestBody Images images){

        return iImagesService.updateImage(images);
    }
}
